<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">
        <ul>
            <li v-for="(item,index) in numArr" :key="index">{{item}} <button @click="del(item)">删除</button></li>
           
        </ul>
        <button @click="add()">生成</button>
        

    </div>
    <script src="../../v2_base_classes/vue.js"></script>
    <script>
        const app=new Vue({
            el:"#app",
            data:{

              numArr:[~~(Math.random()*20),~~(Math.random()*20),~~(Math.random()*20),~~(Math.random()*20)]
            },
            methods:{
                add(){
                    this.numArr.push(~~(Math.random()*20))
                    
                },
                del(i){
                    this.numArr=this.numArr.filter(item=>item!==i)
                }
            }            
        })
    </script>
</body>
</html>